#!/bin/bash

echo "🧹 开始清理项目..."
echo ""

# 1. 删除所有 __pycache__ 目录
echo "1️⃣ 删除 __pycache__ 目录..."
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null
echo "✅ 已删除所有 __pycache__ 目录"
echo ""

# 2. 删除所有 .DS_Store 文件
echo "2️⃣ 删除 .DS_Store 文件..."
find . -name ".DS_Store" -delete
echo "✅ 已删除所有 .DS_Store 文件"
echo ""

# 3. 删除虚拟环境目录
echo "3️⃣ 删除虚拟环境目录..."
if [ -d "new_models/地图坐标获取/lib" ]; then
    rm -rf "new_models/地图坐标获取/lib"
    rm -rf "new_models/地图坐标获取/bin"
    rm -rf "new_models/地图坐标获取/include"
    echo "✅ 已删除虚拟环境目录"
else
    echo "⚠️  虚拟环境目录不存在"
fi
echo ""

# 4. 删除空文件
echo "4️⃣ 删除空文件..."
if [ -f "models/test1.py" ]; then
    rm "models/test1.py"
    echo "✅ 已删除 models/test1.py"
fi
echo ""

# 5. 删除已被替代的文件
echo "5️⃣ 删除已被替代的文件..."
if [ -f "system.py" ]; then
    rm "system.py"
    echo "✅ 已删除 system.py (已被integrated_system.py替代)"
fi
echo ""

# 6. 创建新目录
echo "6️⃣ 创建新目录结构..."
mkdir -p tests
mkdir -p docs
echo "✅ 已创建 tests/ 和 docs/ 目录"
echo ""

echo "🎉 清理完成！"
